<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        html,
        body,
        #app {
            margin: 0;
            padding: 0;
            height: 100%;
        }

        #header, #footer {
            height: 50px;
            line-height: 50px;
            text-align: center;
            background: #555;
            color: #fff;
        }

        #side {
            width: 200px;
            background: #eee;
            height: calc(100% - 100px);
            float: left;
        }

        /* css here */
        ul li {
            /*display: flex;*/
            list-style: none;
            display: inline;
        }

        #main {
            height: calc(100% - 100px);
            margin-left: 200px;
            /*background-color: cyan;*/

        }

        li:after {
            content: '|';
        }
    </style>
</head>
<body>
<div id="app">
    <header id="header">header</header>
    <aside id="side">
        side
    </aside>
    <div id="main">
        <ul>
            <li><a href="https://www.bilibili.com/1">Link1</a></li>
            <li><a href="https://www.bilibili.com/1">Link2</a></li>
            <li><a href="https://www.bilibili.com/1">Link3</a></li>
            <br>
            <li><a href="https://www.bilibili.com/1">Link4</a></li>
            <li><a href="https://www.bilibili.com/1">Link5</a></li>
        </ul>
    </div>
    <footer id="footer">footer</footer>
</div>
<script>
    // JS here
    const a = document.querySelectorAll('a')
    console.log(a)
    for (let i = 0; i < a.length; i++) {
        a[i].addEventListener('click', (e) => {
            e.preventDefault() // 先阻止默认事件
            alert(a[i].href) // 再弹出href链接
            // e.stopPropagation()
            // 事件捕获-》 目标事件 -》 事件冒泡
            // 阻止默认事件： e.preventDefault()
            // 阻止冒泡事件： e.stopPropagation()
        })
    }
</script>
</body>
</html>

